﻿Public Class 目录树
    Private Sub TreeView1_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TreeView1.AfterSelect
        Dim clickedNode As TreeNode = e.Node
        ' 在此处根据节点执行不同的操作
        Select Case clickedNode.Text
            Case "注册账号"
                ClearCellContent(1, 0)
                ' 创建并添加待办清单子窗体 
                Dim childForm As New 注册账号()
                AddChildFormToTableLayoutPanel(主窗体.TableLayoutPanel1, childForm, 1, 0)

            Case "修改密码"
                ClearCellContent(1, 0)
                ' 创建并添加待办清单子窗体 
                Dim childForm As New 修改密码()
                AddChildFormToTableLayoutPanel(主窗体.TableLayoutPanel1, childForm, 1, 0)

            Case "注销账号"
                ClearCellContent(1, 0)
                ' 创建并添加待办清单子窗体 
                Dim childForm As New 注销账号()
                AddChildFormToTableLayoutPanel(主窗体.TableLayoutPanel1, childForm, 1, 0)

            Case "健康管理"
                ClearCellContent(1, 0)
                ' 创建并添加待办清单子窗体 
                Dim childForm As New 健康管理()
                AddChildFormToTableLayoutPanel(主窗体.TableLayoutPanel1, childForm, 1, 0)

            Case "字典管理"
                ClearCellContent(1, 0)
                ' 创建并添加待办清单子窗体 
                Dim childForm As New 字典管理()
                AddChildFormToTableLayoutPanel(主窗体.TableLayoutPanel1, childForm, 1, 0)

            Case "资源分享"
                ClearCellContent(1, 0)
                ' 创建并添加待办清单子窗体 
                Dim childForm As New 资源分享()
                AddChildFormToTableLayoutPanel(主窗体.TableLayoutPanel1, childForm, 1, 0)

            Case "私人账本"
                ClearCellContent(1, 0)
                ' 创建并添加待办清单子窗体 
                Dim childForm As New 私人账本()
                AddChildFormToTableLayoutPanel(主窗体.TableLayoutPanel1, childForm, 1, 0)

        End Select
    End Sub

    Private Sub 目录树_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Label2.Left = 主窗体.TableLayoutPanel1.ColumnStyles(0).Width - Label2.Width - 5
        Label2.Top = 0
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

        Dim tw As Double


        With Label2
            If .Text = "<" Then
                .Left = 0
                .Top = 0
                .Width = 17
                .Height = 17
                .Text = ">"
                主窗体.TableLayoutPanel1.ColumnStyles(0) = New ColumnStyle(SizeType.Absolute, 26.5)
                tw = 主窗体.TableLayoutPanel1.ColumnStyles(0).Width + 主窗体.TableLayoutPanel1.ColumnStyles(2).Width
                主窗体.TableLayoutPanel1.ColumnStyles(1) = New ColumnStyle(SizeType.Absolute, 主窗体.Width - tw)
            Else
                主窗体.TableLayoutPanel1.ColumnStyles(0) = New ColumnStyle(SizeType.Absolute, 200)
                tw = 主窗体.TableLayoutPanel1.ColumnStyles(0).Width + 主窗体.TableLayoutPanel1.ColumnStyles(2).Width
                主窗体.TableLayoutPanel1.ColumnStyles(1) = New ColumnStyle(SizeType.Absolute, 主窗体.Width - tw)
                .Left = 主窗体.TableLayoutPanel1.ColumnStyles(0).Width - .Width - 5
                .Top = 0
                .Width = 17
                .Height = 17
                .Text = "<"
            End If
        End With
    End Sub
End Class